cmake ../../../source \
  -DCMAKE_SYSTEM_NAME=Android \
  -DCMAKE_SYSTEM_VERSION=${ANDROID_API_VERSION} \
  -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a \
  -DCMAKE_ANDROID_NDK=${NDK_ROOT} \
  -DCMAKE_ANDROID_STL_TYPE=c++_static \
  -DNEON_ANDROID=1
 
sed -i 's/-lpthread/-pthread/g' CMakeFiles/cli.dir/link.txt
sed -i 's/-lpthread/-pthread/g' CMakeFiles/x265-shared.dir/link.txt
sed -i 's/-lpthread/-pthread/g' CMakeFiles/x265-static.dir/link.txt
 
make -j${NUMBER_OF_CORES}
make DESTDIR=${OUTPUT_PREFIX}/armeabi-v7a install




cmake -G "Unix Makefiles" \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a \
-DCMAKE_ANDROID_NDK=$ANDROID_NDK \
-DCMAKE_ANDROID_STL_TYPE=c++_shared \
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=21 \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_ASM_COMPILER=$ASM \
-DCMAKE_AR=$AR \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_SHARED=on \
-DENABLE_CLI=off \
-DSTATIC_LINK_CRT=off \
-DENABLE_TESTS=off \
-DENABLE_DOCS=off \
-DENABLE_INSTALL=on \
-DENABLE_THREADING=tbb \
-DNEON_ANDROID=1 \
-DCMAKE_INSTALL_PREFIX=$OUTLIB ../../source

# 修改生成动态库配置文件
sed -i 's/-lpthread/-pthread/g' CMakeFiles/cli.dir/link.txt
sed -i 's/-lpthread/-pthread/g' CMakeFiles/x265-shared.dir/link.txt
sed -i 's/-lpthread/-pthread/g' CMakeFiles/x265-static.dir/link.txt





export NDK=/home/kim/Android-ndk
export PREBUILT=$NDK/toolchains/arm-Linux-androideabi-4.9/prebuilt
export PLATFORM=$NDK/platforms/android-21/arch-arm
export PREFIX=/home/kim/download/x264
./configure --prefix=$PREFIX \
--enable-static \
--enable-pic \
--disable-asm \
--disable-cli \
--host=arm-linux \
--cross-prefix=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi- \
--sysroot=$PLATFORM

# 编译 FFmpeg 时确保包含 --enable-gpl --enable-libx265 选项
./configure \
    --prefix=$PREFIX \
    --enable-gpl \
    --enable-libx265 \
    --enable-nonfree \
    --enable-cross-compile \
    --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
    --sysroot=$SYSROOT \
    --arch=arm \
    --target-os=android \
    --extra-cflags="-I$SYSROOT/usr/include $ADDI_CFLAGS" \
    --extra-ldflags="-L$SYSROOT/usr/lib -L$SYSROOT/usr/lib64" \
    --disable-stripping \
make -j8
make install


